package com.kami.file;

import com.alibaba.excel.EasyExcel;
import com.kami.entity.Student;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description TODO
 * @Author zhenhuiguo
 * @Date 2023/1/1 23:08
 **/
public class Excel {
    public static void main(String[] args) {
        String filename = "src\\excel_test.xlsx";
        EasyExcel.write(filename, Student.class).sheet("sheet1")
                .doWrite(data());

    }
    private static List<Student> data(){
        List<Student> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            Student data = new Student();
            data.setSno(i);
            data.setSname("kami"+i);
            list.add(data);
        }
        return list;
    }

}
